home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / eulisp / mpfeel.lha / MPFeel / global.h < prev    next >
C/C++ Source or Header  |  1992-10-06  |  10KB  |  333 lines

  1. /* ******************************************************************** */
  2. /*  global.h         Copyright (C) Codemist and University of Bath 1989 */
  3. /*                                                                      */
  4. /* Global variables                                            */
  5. /* ******************************************************************** */
  6.  
  7. /*
  8.  * $Id: global.h,v 1.8 1992/02/27 15:48:17 pab Exp $
  9.  *
  10.  * $Log: global.h,v $
  11.  * Revision 1.8  1992/02/27  15:48:17  pab
  12.  * lose alloc_condition
  13.  *
  14.  * Revision 1.7  1992/02/10  12:08:45  pab
  15.  * macroised allocate_integer
  16.  *
  17.  * Revision 1.6  1992/01/29  13:41:50  pab
  18.  * sysV fixes
  19.  *
  20.  * Revision 1.5  1992/01/10  15:17:56  pab
  21.  * changed allocate_integer for fixnums
  22.  *
  23.  * Revision 1.4  1991/12/22  15:14:11  pab
  24.  * Xmas revision
  25.  *
  26.  * Revision 1.3  1991/11/15  13:44:52  pab
  27.  * copyalloc rev 0.01
  28.  *
  29.  * Revision 1.2  1991/09/11  12:07:16  pab
  30.  * 11/9/91 First Alpha release of modified system
  31.  *
  32.  * Revision 1.1  1991/08/12  16:49:39  pab
  33.  * Initial revision
  34.  *
  35.  * Revision 1.7  1991/05/16  11:23:16  pab
  36.  * 'C' garbage collector support
  37.  *
  38.  * Revision 1.5  1991/02/13  18:21:16  kjp
  39.  * New class declarations.
  40.  *
  41.  */
  42.  
  43. /*
  44.  * Change Log:
  45.  *   Version 1, April 1989
  46.  *     Reserved slot declarations and make_special_symbol prototype
  47.  */
  48.  
  49. #ifndef GLOBAL_H
  50. #define GLOBAL_H
  51.  
  52. #include <stdio.h>
  53. #ifndef SETJMP_H
  54. #define SETJMP_H
  55. #include <setjmp.h>
  56. #endif
  57.  
  58. #ifdef WITH_BIGNUMS
  59. extern void initialise_bignums(void);
  60. extern LispObject Big_Integer;
  61. #endif
  62.  
  63. extern LispObject ObList;
  64.  
  65. extern LispObject Object;
  66. extern LispObject nil;
  67. extern LispObject lisptrue;
  68. extern LispObject unbound;
  69.  
  70. /* Meta classes */
  71.  
  72.  
  73. extern LispObject Object;
  74. extern LispObject  Standard_Class;
  75. extern LispObject   Slot_Description_Class;
  76. extern LispObject     Slot_Description;
  77. extern LispObject      Local_Slot_Description;
  78.  
  79. extern LispObject Abstract_Class;
  80.  
  81. /* Allocation specifying metaclasses */
  82.  
  83. extern LispObject Structure_Class;                /* Like to C structs */
  84. extern LispObject Funcallable_Object_Class;       /* Function forms */
  85. extern LispObject Generic_Class;
  86. extern LispObject Pair_Class;
  87. extern LispObject Unpredictable_Fixed_Size_Class; /* Vector-type things */
  88. extern LispObject Variable_Size_Keyed_Class;      /* Tabular instances */
  89. extern LispObject Thread_Class;
  90. extern LispObject Method_Class;
  91.  
  92. /* The core building blocks */
  93.  
  94. extern LispObject Abstract_Class; /* Meta */
  95. extern LispObject Number, Complex, Real, Rational, Integer;
  96. extern LispObject Symbol, Character, String;
  97. extern LispObject Thread, Continue;
  98. extern LispObject Function, Generic, Method;
  99.  
  100. /* Composites */
  101.  
  102. extern LispObject Cons, Vector, Table, Null;
  103.  
  104. /* Pointer */
  105.  
  106. extern LispObject Weak_Wrapper;
  107.  
  108. /* KJP prototypes */
  109.  
  110. extern LispObject Slot_Initarg;
  111. extern LispObject Default_Initargs;
  112.  
  113. extern LispObject Object_Class;     /* Reserved slot symbols */
  114. extern LispObject Class_Name;
  115. extern LispObject Class_Parent;
  116. extern LispObject Class_Children;
  117. extern LispObject Class_Instance_Description;
  118.  
  119. extern LispObject Slot_Class; /* A slot option */
  120.  
  121. extern LispObject Slot_Name;                    /* Slot descriptor fields */
  122. extern LispObject Slot_Position;
  123. extern LispObject Slot_Reader;
  124. extern LispObject Slot_Writer;
  125. extern LispObject Slot_Initform;  /* Local */
  126. extern LispObject Slot_Value;     /* Shared */
  127.  
  128. extern void make_special_symbol(LispObject*, LispObject *, char * );
  129.  
  130. extern void put_table( LispObject, LispObject );
  131.  
  132. extern void bootstrap(LispObject*);
  133. extern LispObject Fn_plus(LispObject*);
  134. extern LispObject Fn_difference(LispObject*);
  135.  
  136. /* Vectors */
  137.  
  138. extern void initialise_vectors(LispObject* );
  139.  
  140. /* Others I needed prototypes for */
  141.  
  142. EUDECL(Fn_symbolvalue);
  143.  
  144. /* KJP def end */
  145.  
  146. extern LispObject q_eof;
  147.  
  148. extern struct cons_structure *free_cons;
  149. extern struct cons_structure *cons_hunks;
  150. extern struct symbol_structure *free_symbol;
  151. extern struct symbol_structure *symbol_hunks;
  152. extern struct table_structure *free_table;
  153. extern struct table_structure *table_hunks;
  154. extern struct vector_structure *free_vectors;
  155. extern struct vector_structure *vector_hunks;
  156. extern struct function_structure *free_function;
  157. extern struct function_structure *function_hunks;
  158. extern struct string_structure *free_string;
  159. extern struct string_structure *string_hunks;
  160. extern struct character_structure *free_character;
  161. extern struct character_structure *character_hunks;
  162. extern struct stream_structure *free_stream;
  163. extern struct stream_structure *stream_hunks;
  164. extern struct integer_structure *free_integer;
  165. extern struct integer_structure *integer_hunks;
  166. extern struct float_structure *free_float;
  167. extern struct float_structure *float_hunks;
  168. extern struct ratio_structure *free_ratio;
  169. extern struct ratio_structure *ratio_hunks;
  170. extern struct complex_structure *free_complex;
  171. extern struct complex_structure *complex_hunks;
  172. extern struct condition_structure *free_condition;
  173. extern struct condition_structure *condition_hunks;
  174. extern struct continue_structure *free_continue;
  175. extern struct continue_structure *continue_hunks;
  176. extern struct module_structure *free_module;
  177. extern struct module_structure *module_hunks;
  178. extern struct class_structure *free_class;
  179. extern struct class_structure *class_hunks;
  180. extern struct instance_structure *free_instance;
  181. extern struct instance_structure *instance_hunks;
  182. extern struct thread_structure *free_thread;
  183. extern struct thread_structure *thread_hunks;
  184. extern LispObject free_methods;
  185. extern LispObject method_hunks;
  186.  
  187. extern Env free_env;
  188. extern Env env_hunks;
  189.  
  190. EUDECL( Fn_cons);
  191. extern LispObject allocate_symbol(LispObject*,char *);
  192. extern LispObject allocate_table(LispObject*,LispObject (*)(LispObject*));
  193. LispObject allocate_vector(LispObject *,int);
  194. extern LispObject allocate_function(int,LispObject(*)(), int, LispObject);
  195.  
  196. extern LispObject Fn_eq(LispObject*);
  197. extern LispObject Fn_equal(LispObject*);
  198. extern LispObject Fn_read(LispObject*);
  199. extern LispObject Fn_prin(LispObject*);
  200. extern LispObject Fn_print(LispObject*);
  201. extern LispObject Fn_nreverse(LispObject*);
  202. extern LispObject Fn_make_table(LispObject*);
  203. extern LispObject Fn_tref(LispObject*);
  204. extern LispObject tref_updator(LispObject*);
  205. extern LispObject table_copy(LispObject*);
  206. extern LispObject Fn_length(LispObject*);
  207.  
  208. extern LispObject allocate_char(LispObject*,char);
  209. extern LispObject allocate_stream(LispObject*,FILE*, int);
  210. extern LispObject allocate_string(LispObject*,char *,int);
  211. #ifdef NOLOWTAGINTS
  212. #define STATIC_INTEGERS 1024
  213. extern LispObject static_ints;
  214.  
  215. extern LispObject real_allocate_integer(LispObject*, int);
  216. #define allocate_integer(stacktop,x) \
  217.   ((x>=0 && x<STATIC_INTEGERS) ? vref(static_ints,x) : real_allocate_integer(stacktop,x))
  218.     
  219. #else
  220. #define allocate_integer(waste,x) (mk_fixnum(x))
  221. #endif
  222. extern LispObject allocate_ratio(LispObject*,LispObject, LispObject);
  223. extern LispObject allocate_float(LispObject*,double);
  224. extern LispObject allocate_complex(LispObject*,LispObject, LispObject);
  225. extern LispObject allocate_continue(LispObject*);
  226. extern LispObject allocate_thread(LispObject*,int, int, int);
  227. extern LispObject allocate_module(LispObject*,LispObject, Env, LispObject);
  228. extern LispObject make_module_function(LispObject*,
  229.                        char *, LispObject(*)(), int);
  230. extern LispObject make_special(char *, LispObject(*)());
  231. extern LispObject allocate_env(LispObject*,LispObject, LispObject, LispObject);
  232. extern LispObject allocate_envimut(LispObject*,
  233.                    LispObject, LispObject, LispObject);
  234.  
  235. extern LispObject allocate_condition_class(LispObject*,int, LispObject, 
  236.                        LispObject, LispObject);
  237. extern LispObject allocate_class(LispObject*,LispObject);
  238. extern LispObject allocate_instance(LispObject*,LispObject);
  239.  
  240. extern LispObject Fn_set(LispObject*);
  241. extern void set_associate(LispObject*,LispObject, LispObject);
  242. extern void set_anon_associate(LispObject*,LispObject, LispObject);
  243.  
  244. extern void initialise_input(LispObject*);
  245. extern void re_initialise_input(void);
  246. extern LispObject sym_quote;
  247. extern LispObject sym_quasiquote;
  248. extern LispObject sym_unquote;
  249. extern LispObject sym_progn;
  250. extern LispObject sym_defun;
  251. extern LispObject sym_defglobal;
  252. extern LispObject sym_setq;
  253.  
  254. extern void initialise_output(LispObject*);
  255. extern void initialise_eval(void);
  256. extern LispObject sym_lambda;
  257. extern void initialise_basic(LispObject*);
  258. extern void initialise_generics(LispObject*);
  259. extern void initialise_chars(LispObject*);
  260. extern void initialise_streams(LispObject*);
  261. extern void initialise_tables(LispObject*);
  262. extern void initialise_set(LispObject*);
  263. extern void initialise_error(LispObject*);
  264. extern void initialise_arith(LispObject*);
  265. extern void initialise_threads(LispObject*);
  266. extern void initialise_modules(LispObject*);
  267. extern void initialise_classes(LispObject*);
  268. extern LispObject sym_handler, sym_accept, sym_decline;
  269. extern LispObject sym_dynamic;
  270. extern LispObject sym_dynamic_let;
  271. extern LispObject sym_table_copy;
  272.  
  273. extern LispObject StdIn;
  274. extern LispObject StdOut;
  275. extern LispObject StdErr;
  276.  
  277. #ifdef CGC
  278. #define malloc gc_malloc
  279. #endif
  280.  
  281. #ifdef xxx
  282. #ifdef __STDC__
  283. extern void *malloc(unsigned);
  284. #else
  285. extern char* malloc(int);
  286. #endif
  287. #endif
  288. extern void exit(int);
  289.  
  290. /*
  291.  * Globally used thread information... 
  292.  */
  293.  
  294. #include "state.h"
  295.  
  296. /* ought to check for under/overflow */
  297. #ifdef no_way_hose /* Sat Sep  7 19:10:03 1991 */
  298. /**/
  299. /**/#ifdef WITH_PARANOIA
  300. /**/
  301. /**/#define STACK(name)     (GC_STACK_POINTER()*sizeof(LispObject*) \
  302. /**/             < CURRENT_THREAD()->THREAD.gc_stack_size-10 \
  303. /**/             ? GC_STACK_BASE()[GC_STACK_POINTER()++] \
  304. /**/                 = (LispObject*)&(name) \
  305. /**/             : (LispObject*)CallError("INTERNAL ERROR: GC stack overflow",nil,NONCONTINUABLE))
  306. /**/
  307. /**/#define UNSTACK(n)      (GC_STACK_POINTER() >= n \
  308. /**/             ? GC_STACK_POINTER() -= n \
  309. /**/             : (int)CallError("INTERNAL ERROR: GC stack underflow",nil,NONCONTINUABLE))
  310. /**/
  311. /**/#else
  312. /**/#ifdef CGC /* Shouldnae ned this... */
  313. /**/#define STACK(name) 0
  314. /**/#define UNSTACK(n) 0
  315. /**/#else
  316. /**/
  317. /**/#define STACK(name)    *(GC_STACK_POINTER()) = (LispObject)(name); \
  318. /**/                       ++GC_STACK_POINTER();
  319. /**/#define UNSTACK(n)     GC_STACK_POINTER() -= n
  320. /**/#endif
  321. /**/#endif
  322. #endif /* no_way_hose Sat Sep  7 19:10:03 1991 */
  323.  
  324. #define STACK(x) 0
  325. #define UNSTACK(n) 0
  326.  
  327. #define N_SLOTS_IN_STRUCT(x) \
  328.   (((sizeof(x))-sizeof(Object_t))/sizeof(LispObject))
  329.  
  330. #endif /* GLOBAL_H */
  331. /* End of global.h */
  332.  
  333.